<?php #coding: utf-8 æ ø å

class Side_model extends CI_Model {

    function sider_ialt(){
	    $query = $this->db->query
		    ('
                SELECT id FROM element 
                WHERE slettet = 0
                ORDER BY id DESC
            ');
        $data['antal_sider'] = $query->num_rows(); 
        $data['sidetal_highest'] = $query->row();

return $data;


    }




    function sider_entiteter(){
        $query = $this->db->query
		    ('
                SELECT element.id
                FROM entitet, element  
                WHERE element.slettet = 0
                AND element.id = entitet.id
                ORDER BY id DESC
            ');
        return $query->num_rows();
    }


    function sider_steder(){
        $query = $this->db->query
		    ('
                SELECT element.id
                FROM sted, element  
                WHERE element.slettet = 0
                AND element.id = sted.id
                ORDER BY id DESC
            ');
        return $query->num_rows();

    }


    function sider_begivenheder(){
        $query = $this->db->query
		    ('
                SELECT element.id
                FROM begivenhed, element  
                WHERE element.slettet = 0
                AND element.id = begivenhed.id
                ORDER BY id DESC
            ');
        return $query->num_rows();

    }

    function sider_slettede(){
        $query = $this->db->query
		    ('
                SELECT element.id
                FROM element  
                WHERE element.slettet = 1

            ');
        return $query->num_rows();

    }


    function register(){


        $query = $this->db->query
		    ('
                SELECT element.id, navn.navn, element.type
                FROM element, navn  
                WHERE element.slettet = 0
                AND navn.id_element = element.id
                ORDER BY navn ASC

            ');
    
            return $query->result();

    }




}
